package com.db.deviceType.controller;

import com.db.core.vo.PageResult;
import com.db.core.vo.R;
import com.db.deviceType.dto.DeviceTypePageDto;
import com.db.deviceType.entity.DeviceType;
import com.db.deviceType.service.DeviceTypeService;
import com.db.industry.entity.Industry;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * 作者：Bin
 * 时间：2023/10/30
 * 描述：键盘敲烂，薪资过万
 */
@RestController
@RequestMapping("deviceType")
@CrossOrigin
public class DeviceTypeController {

    @Autowired
    private DeviceTypeService deviceTypeService;

    @PostMapping("page")
    public PageResult page(@RequestBody DeviceTypePageDto deviceTypePageDto){
        return deviceTypeService.page(deviceTypePageDto);
    }

    @GetMapping("all")
    public R all(){
        return R.ok(deviceTypeService.list(),"success");
    }

    @PostMapping("add")
    public R add(@RequestBody DeviceType deviceType){
        return deviceTypeService.insert(deviceType);
    }

    @PostMapping("edit")
    public R edit(@RequestBody DeviceType deviceType){
        return deviceTypeService.update(deviceType);
    }


}
